package ${file.packageName};

public class ${name} {

    <#list file.messageTypes as messageType>
    public static class ${messageType.name} {
        <#list messageType.fields as field>
        public ${field.type} ${field.name};

        public ${field.type} ${field.outputMethod}() {
            return ${field.name};
        }
        </#list>

        private ${messageType.name}(Builder builder) {
            <#list messageType.fields as field>
            ${field.name} = builder.${field.name};
            </#list>
        }

        public static Builder newBuilder() {
            return new Builder();
        }

        public static final class Builder {
            <#list messageType.fields as field>
            private ${field.type} ${field.name};
            </#list>

            public Builder() {
            }

            <#list messageType.fields as field>
            public Builder ${field.inputMethod}(${field.type} ${field.name}) {
                this.${field.name} = ${field.name};
                return this;
            }
            </#list>

            public ${messageType.name} build() {
                return new ${messageType.name}(this);
            }
        }
    }
    </#list>
}
